<%@ page language="java" import="java.util.*" contentType="text/html;charset=utf-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c" %>
<%
	String path=request.getContextPath();
	session.setAttribute("path",path);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>控制台页面_企业工资管理系统</title>
<link rel="stylesheet" href="${path}/resources/css/style.default.css" type="text/css" />

<script type="text/javascript" src="${path}/resources/js/plugins/jquery-1.7.min.js"></script>
<script type="text/javascript" src="${path}/resources/js/plugins/jquery.cookie.js"></script>
<script type="text/javascript" src="${path}/resources/js/plugins/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="${path}/resources/js/plugins/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="${path}/resources/js/plugins/ui.spinner.min.js"></script>
<script type="text/javascript" src="${path}/resources/js/plugins/jquery.jgrowl.js"></script>
<script type="text/javascript" src="${path}/resources/js/plugins/jquery.alerts.js"></script>
<script type="text/javascript" src="${path}/resources/js/plugins/uploadPreview.min.js"></script>
<script type="text/javascript" src="${path}/resources/js/general.js"></script>
<script type="text/javascript" src="${path}/resources/js/userInfo.js"></script>
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="js/plugins/excanvas.min.js"></script><![endif]-->
<!--[if IE 9]>
    <link rel="stylesheet" media="screen" href="css/style.ie9.css"/>
<![endif]-->
<!--[if IE 8]>
    <link rel="stylesheet" media="screen" href="css/style.ie8.css"/>
<![endif]-->
<!--[if lt IE 9]>
	<script src="js/plugins/css3-mediaqueries.js"></script>
<![endif]-->

<style>
.stdform{
	align:center;
}
.stdform label {
	width:80px;
	text-align:center;
}
.stdform span.field, .stdform div.field {
	margin-left:80px
}

.stdform .formwrapper {
	margin-left:80px
}

#user_dialog {
	display:none;
	height:auto;
}
.stdform p {
	width:70%
}
</style>
</head>

<body class="withvernav">
<div class="bodywrapper">
    <div class="topheader">
			<div class="left">
				<h1 class="logo">
					企业<span>工资管理系统</span>
				</h1>
				<br clear="all" />
			</div>
			<!--left-->

			<div class="right">
				<div class="userinfo">
					<img src="${path}/resources/images/thumbs/avatar.png" alt="" />
					<span> ${employee.empNo}</span>
				</div>
				<!--userinfo-->

				<div class="userinfodrop">
					<div class="avatar">
						<a href=""><img src="${path}/resources/images/thumbs/avatarbig.png" alt="" /></a>
						<div class="changetheme">
							切换主题: <br /> <a class="default"></a> <a class="blueline"></a> <a
								class="greenline"></a> <a class="contrast"></a> <a
								class="custombg"></a>
						</div>
					</div>
					<!--avatar-->
					<div class="userdata">
						<h4>${employee.empName}</h4>
						<span class="email">${employee.empEmail}</span>
						<ul>
							<li><a href="${path}/employee/editProfile">编辑资料</a></li>
							<li><a href="${path}/employee/password">修改密码</a></li>
							<li><a href="#">帮助</a></li>
							<li><a href="${path}/employee/logout">退出</a></li>
						</ul>
					</div>
					<!--userdata-->
				</div>
				<!--userinfodrop-->
			</div>
			<!--right-->
		</div>
		<!--topheader-->


		<div class="header">
			<ul class="headermenu">
				<li><a href="${path}/employee/profile"><span
						class="icon icon-flatscreen"></span>首页</a></li>
				<li><a href="${path}/department"><span
						class="icon icon-pencil"></span>部门信息管理</a></li>
				<li><a href="${path}/post"><span
						class="icon icon-message"></span>岗位信息管理</a></li>
				<li class="current"><a href="${path}/employee"><span
						class="icon icon-pencil"></span>员工信息管理</a></li>
				<c:if test="${employee.isAdmin == 1 }">
				<li><a href="${path}/timecard"><span
						class="icon icon-speech"></span>考勤信息管理</a></li>
				</c:if>
				<c:if test="${employee.isAdmin == 0 }">
				<li><a href="${path}/timecard/myTimecards"><span
						class="icon icon-speech"></span>考勤信息管理</a></li>
				</c:if>
				<li><a href="${path}/bonus"><span 
						class="icon icon-chart"></span>奖金信息管理</a></li>
				<li><a href="${path}/salaryRecord"><span 
						class="icon icon-message"></span>工资信息管理</a></li>
			</ul>
		</div>
		<!--header-->

		<div class="vernav2 iconmenu">
			<ul>
				<li><a href="${path}/department" class="widgets">部门信息管理</a></li>
	        	<li><a href="${path}/post" class="support">岗位信息管理</a></li>
	            <li class="current"><a href="${path}/employee" class="tables">员工信息管理</a></li>
	            <li><a href="#attend" class="calendar">考勤信息管理</a>
	            	<span class="arrow"></span>
	            	<ul id="attend">
	            		<c:if test="${employee.isAdmin == 1 }">
	               		<li><a href="${path}/timecard">考勤-日历模式</a></li>
	               		</c:if>
	               		<c:if test="${employee.isAdmin == 0 }">
	               		<li><a href="${path}/timecard/myTimecards">考勤-日历模式</a></li>
	               		</c:if>
	                    <li><a href="${path}/timecard/table">考勤-表格模式</a></li>
	                </ul>
            	</li>
	            <li><a href="${path}/bonus" class="tables">奖金信息管理</a>
	            </li>
	            <li><a href="#salary" class="widgets">工资信息管理</a>
	            	<span class="arrow"></span>
	            	<ul id="salary">
	            		<c:if test="${employee.isAdmin == 1 }">
	            		 <li><a href="${path}/salaryRecord/calPre">工资结算</a></li>
	            		 </c:if>
	                    <li><a href="${path}/salaryRecord">工资记录</a></li>
	                    <c:if test="${employee.isAdmin == 1 }">
	                    <li><a href="${path}/postSalary">工资结构调整</a></li>
	                    </c:if>
	                    <c:if test="${employee.isAdmin == 0 }">
	                    <li><a href="${path}/postSalary/myStructure">我的工资结构</a></li>
	                    </c:if>
	                </ul>
            	</li>
        	</ul>
			<a class="togglemenu"></a> <br />
			<br />
		</div>
		<!--leftmenu-->
        
    <div class="centercontent">
    
        
        <div id="contentwrapper" class="contentwrapper">
        	<c:if test="${employee.isAdmin == 1 }">
        	<div style="margin-bottom:30px">
	        	<a id="addUserBtn" class="btn btn_orange btn_book" style="float:right"><span>添加</span></a>
           	</div>
           	</c:if>
        	
        	<div id="user_dialog" title="修改员工信息">
  				<form id="editUserInfo" class="stdform" method="post" action="/employee/edit"  enctype="multipart/form-data">
  					<input type="hidden" name="employee.empId" id="employeeId"/>
  					<div style="float:right; width:160px">
                    	<img id="empPhoto" src="${path}/resources/employeePic/default.png" style="width:120px; height:150px;margin-right:20px"></img>
                         <c:if test="${employee.isAdmin == 1 }"> <input type="file" id="upload" name="empPic" /></c:if>
                    </div>
                    	<p>
                        	<label>员工编号：</label>
                            <span class="field"><input type="text" readonly="readonly" style="width:50%; background-color:#CCCCCC" name="employee.empNo" id="empNo" /></span>
                        </p>
                        
                        <p>
                        	<label>员工姓名：</label>
                            <span class="field"><input type="text" style="width:70%;" name="employee.empName" id="empName" <c:if test="${employee.isAdmin == 0 }">disabled</c:if> /></span>
                        </p>
                        
                         <p>
                        	<label>所属部门：</label>
                             <span class="field">
								<select name="deptId" id="deptId" style="width:70%;"<c:if test="${employee.isAdmin == 0 }">disabled</c:if> >
								<option value="">请选择</option>
								<c:forEach items="${departments}" var="department">
								<option value="${department.deptId}">${department.deptName}</option>
								</c:forEach>
								</select>
							 </span> 
                        </p>
                        <p>
                        	<label>所属岗位：</label>
                             <span class="field" >
								<select name="employee.postId" id="postId"  style="width:70%;" <c:if test="${employee.isAdmin == 0 }">disabled</c:if>>
								</select>
							 </span> 
                        </p>
                        
                        <p>
                        	<label>性别：</label>
                            <span class="formwrapper" >
                            	<input type="radio" id="boy" name="employee.empGender" value="男" <c:if test="${employee.isAdmin == 0 }">disabled</c:if> />男&nbsp; &nbsp;&nbsp; &nbsp;
                            	<input type="radio" id="girl" name="employee.empGender" value="女" <c:if test="${employee.isAdmin == 0 }">disabled</c:if> />女
                            </span>
                        </p>
                        
                        <p>
                        	<label>出生年月：</label>
                            <span class="field"><input id="empBirth" type="text" name="employee.empBirth"  <c:if test="${employee.isAdmin == 0 }">disabled</c:if>
							class="width100" /> </span>
                        </p>
                        
                        <p>
                        	<label>电话号码：</label>
                            <span class="field"><input type="text" style="width:80%;" name="employee.empPhone" id="empPhone" <c:if test="${employee.isAdmin == 0 }">disabled</c:if>/></span>
                        </p>
                        
                        <p>
                        	<label>电子邮件：</label>
                            <span class="field"><input type="text" style="width:80%;" name="employee.empEmail" id="empEmail" <c:if test="${employee.isAdmin == 0 }">disabled</c:if>/></span>
                        </p>
                        
                        <p>
                        	<label>管理员：</label>
                            <span class="formwrapper" >
                            	<input type="radio" id="isAdmin" name="employee.isAdmin" value="1" <c:if test="${employee.isAdmin == 0 }">disabled</c:if>/>是&nbsp; &nbsp;&nbsp; &nbsp;
                            	<input type="radio" id="notAdmin" name="employee.isAdmin" value="0" <c:if test="${employee.isAdmin == 0 }">disabled</c:if>/>否
                            </span>
                        </p>
                        
                        <p style="width:100%">
                        	<label>地址：</label>
                             <span class="field"><textarea cols="80" rows="5" name="employee.empAddress" id="empAddress" class="longinput" <c:if test="${employee.isAdmin == 0 }">disabled</c:if>></textarea></span> 
                        </p>
                        <br />
                        <c:if test="${employee.isAdmin == 1 }">
                        <p class="stdformbutton">
                        	<button id="editBtn" class="submit radius2">确认修改</button>
                        	<button id="addBtn" class="submit radius2">确认添加</button>
                        </p>
                        </c:if>
                    </form>
			</div>
        	
                <table cellpadding="0" cellspacing="0" border="0" class="stdtable" id="userTable">
                    <colgroup>
                    	<col class="con1" width="5%"/>
                        <col class="con0" width="5%"/>
                        <col class="con1" />
                        <col class="con0" />
                        <col class="con1"/>
                        <col class="con0" width="5%"/>
                        <col class="con1" width="8%"/>
                        <col class="con0"/>
                        <col class="con1" />
                        <col class="con0" width="6%"/>
                        <col class="con1" width="18%"/>
                    </colgroup>
                    <thead>
                        <tr>
                        	<th class="head1">NO</th>
                            <th class="head0">编号</th>
                            <th class="head1">姓名</th>
                            <th class="head0">岗位</th>
                            <th class="head1">部门</th>
                            <th class="head0">性别</th>
                            <th class="head1">出生日期</th>
                            <th class="head0">电话</th>
                            <th class="head1">邮箱</th>
                            <th class="head0">管理员</th>
                            <th class="head1">操作</th>
                        </tr>
                    </thead>
                    
                    <tbody>
                    	<c:forEach items="${employees}" var="emp" varStatus="status">
                    		<tr class="gradeA">
                    		<td>${status.index + 1}</td>
                            <td>${emp.empNo}</td>
                            <td>${emp.empName}</td>
                            <td>${emp.postName}</td>
                            <td>${emp.deptName}</td>
                            <td>${emp.empGender}</td>
                            <td>${emp.empBirth}</td>
                            <td>${emp.empPhone}</td>
                            <td>${emp.empEmail}</td>
                            <td>${emp.isAdmin==1?'是':'否'}</td>
							<td style="text-align:center">
							<c:if test="${employee.isAdmin == 1 }">
							<a class="btn btn_link" onclick="showEditDialog(${emp.empId})"><span>编辑</span></a>
                            <a onclick='confirmDelete(${emp.empId},"${emp.empNo}","${emp.empName}");' class="btn  btn_trash "><span>删除</span></a>
                            </c:if>
                            <c:if test="${employee.isAdmin == 0 }">
							<a class="btn btn_link" onclick="showEditDialog(${emp.empId})"><span>查看</span></a>
                            </c:if>
                            </td>
                        	</tr>
                    	</c:forEach>
                    </tbody>
                </table>
                
          <br /><br />
        	
        </div><!--contentwrapper-->
        
        <br clear="all" />
        
	</div><!-- centercontent -->
</div><!--bodywrapper-->
</body>
</html>
